  <extend name="Public:common" />

<block name="main">
    <form action="{:U('Cate/insert')}" id="j_custom_form" class="col-md-12 form-label-right form-validate" method="post" url="{:U('Cate/index')}" callback="TabAjaxDone" noEnter>
      
       <div class="pageContainer">
            <div class="form-row">
                <div class="form-label col-md-2"><label>分类名：</label>
                </div>
                <div class="form-input col-md-7">
                <input type="text" size="30" class="validate[required,minSize[3]] required"  name="name" id="j_name" value=""  >
               </div>
            </div>
            <div class="form-row">
                <div class="form-label col-md-2"><label>上级分类：</label>
                 </div>
                <div class="col-md-7">
                 <select name="pid"  data-container="body"  id="j_pid" class="selectpicker show-tick" data-style="btn medium bg-green" data-width="auto">
                               <option value="0">无</option>
                               <volist name="list" id="vo">
                                 <option value="{$vo.id}">{$vo.name}</option>
                                
                                </volist>
                 </select>
                 </div>
            </div>
           <div class="form-row">
                <div class="form-label col-md-2"><label>状态：</label>
              </div>
                <div class="col-md-7">
               <select name="status"  data-container="body"  id="j_status" class="selectpicker show-tick validate[required]" data-style="btn medium bg-green" data-width="auto">
                               
                                 <option value="1">启用</option>
                                <option value="0">禁用</option>
                 </select>
                
            </div></div>
                 <div class="form-row">
                <div class="form-label col-md-2"><label>会员权限：</label>
                </div>
                <div class="col-md-7">
               <select name="enable"  data-container="body"  id="j_enable" class="selectpicker show-tick" data-style="btn medium bg-green" data-width="auto">
                               
                                 <option  value="1">会员可发布</option>
                                <option  value="0">会员禁止发布</option>
                 </select>
            </div></div>
           <div class="form-row">
                <div class="form-label col-md-2"><label>类型：</label>
                </div>
                <div class="col-md-7">
               <select name="type"  data-container="body"  id="j_type" class="selectpicker show-tick" data-style="btn medium bg-green" data-width="auto">
                              
						<option value="{:S('catetype')}">{:get_cate_type(S('catetype'))}</option>
					
                 </select>
                 
            </div>
            
		</div>
		 <div class="form-row">
                <div class="form-label col-md-2"><label>分类描述：</label>
                </div>
                <div class="col-md-7">
              <textarea class="autosize" rows="4" cols="30" name="des"></textarea>
                 
            </div>
            
		</div>
		 <div class="form-row">
		<div class="form-label col-md-2">
<label>分类图片：</label></div>
<div class="col-md-7">
					<input type="file" id="upload_picture_advspic">
					<input type="hidden" name="img" id="cover_id_advspic" value="{$info.img}"/>
					<div class="upload-img-box">
						<notempty name="info['img']"><div class="upload-pre-item">
						<img src="__ROOT__{$info.path}"/></div></notempty>
					</div>
				
		
					</div>
			</div>
			
<script type="text/javascript">
$(function(){
	setTimeout(function(){
	$("#upload_picture_advspic").uploadify({
        "height"          : 30,
        "swf"             : "__STATIC__/uploadify/uploadify.swf",
        "fileObjName"     : "Picture",
        "buttonText"      : "<span class='button-content'><i class='glyph-icon icon-picture-o'></i> 上传图片</span>",
        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
        "width"           : 120,
        'removeTimeout'	  : 1,
        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
        "onUploadSuccess" : uploadPicture{$field.name},
        'onFallback' : function() {
            alert('未检测到兼容版本的Flash.');
        }
    });
	},3);


   
});
function uploadPicture{$field.name}(file,data){
	var data = $.parseJSON(data);
	
	
	var src = '';
    if(data.status){
    	$("#cover_id_advspic").val(data.id);
    	src = data.url || data.path
    	$("#cover_id_advspic").parent().find('.upload-img-box').html(
    		'<div class="upload-pre-item"><img src="' + src + '" width="100" height="100" onclick="imgpop(this)"/></div>'
    	);
    } else {
    	 alertMsg.error(data.info);
    	
    }
}
</script>
		  <div class="actionBar">
               
                <div class="form-input col-md-10 col-md-offset-2">
                   <button type="submit" class="btn medium bg-blue">保存</button>
           <button type="button" url="{:U('Cate/index')}" class="btn-close btn medium bg-red mrg15L">取消</button>
                </div>
            </div>
            </div>
    </form>
</block>